<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $configs['websiteName'] . '——用户资料修改' ?></title>
<title><?php echo $configs['websiteName'] ?></title>
<link type="text/css" rel="stylesheet" href="<?php echo CSS_DIR ?>/base.css" />
<link type="text/css" rel="stylesheet" href="<?php echo CSS_DIR ?>/default.css" />
<link type="text/css" rel="stylesheet" href="<?php echo CSS_DIR ?>/register.css" />
<link type="text/css" rel="stylesheet" href="<?php echo CSS_DIR ?>/article.css" />
<link type="text/css" rel="stylesheet" href="<?php echo CSS_DIR ?>/validator.css" />
<script src="<?php echo JS_DIR ?>/jquery.js" type="text/javascript"></script>
<script src="<?php echo JS_DIR ?>/formValidator_lcg.js" type="text/javascript"></script>
<script src="<?php echo JS_DIR ?>/formValidatorRegex.js" type="text/javascript"></script>
<script src="<?php echo JS_DIR ?>/modify.js" type="text/javascript"></script>
<script type="text/javascript">
function Reset_ImgSize(obj, MaxW, MaxH) {
    if (obj != null) imageObject = obj;
    var state=imageObject.readyState;
    var oldImage = new Image();
    oldImage.src = imageObject.src;
    var dW=oldImage.width; var dH=oldImage.height;
    if(dW>MaxW || dH>MaxH) {
        a=dW/MaxW; b=dH/MaxH;
        if(b>a) a=b;
        dW=dW/a; dH=dH/a;
    }
    if(dW > 0 && dH > 0)
        imageObject.width=dW;imageObject.height=dH;
    if(state!='complete' || imageObject.width>MaxW || imageObject.height>MaxH) {
        setTimeout("ResizeImage(null,"+MaxW+","+MaxH+")",40);
    }
}
</script>
</head>

<body>
<?php require($header) ?>

<div class="container center">
	<div id="article">
		<div id="title">用户资料修改</div>
			<form action="<?php echo url('user', 'modify') ?>" method="post" enctype="multipart/form-data" name="registerForm" id="registerForm">
			<div class="title">设置您的基本资料</div>
			<hr class="ds">
			<div class="subForm">
				<div class="item">
					<div class="subTitle">学号：</div>
					<div class="inputBox"><?php echo $user['num'] ?><?php echo $form['user_id'] ?></div>
					<div></div>
				</div>
				<div class="item">
					<div class="subTitle">真实姓名：</div>
					<div class="inputBox"><?php echo $user['trueName'] ?></div>
					<div></div>
				</div>
				<div class="item">
					<div class="subTitle">性别：</div>
					<div class="inputBox"><?php echo $form['sex'] ?></div>
				</div>
				<div class="item">
					<div class="subTitle">籍贯：</div>
					<div class="inputBox"><?php echo $form['province'] ?></div>
				</div>
				<div class="item">
					<div class="subTitle">政治面貌：</div>
					<div class="inputBox"><?php echo $form['politics'] ?></div>
				</div>
				<div class="item">
					<div class="subTitle">是否持有绿卡：</div>
					<div class="inputBox"><?php echo $form['poor'] ?></div>
					<div id="poor_4Tip"></div>
				</div>
				<div class="item">
					<div class="subTitle">层次：</div>
					<div class="inputBox"><?php echo $form['userType'] ?></div>
				</div>
				<div class="item">
					<div class="subTitle">学院：</div>
					<div class="inputBox"><?php echo $form['college'] ?></div>
					<div id="collegeTip"></div>
				</div>
				<div class="item">
					<div class="subTitle">系：</div>
					<div class="inputBox"><?php echo $form['department'] ?></div>
					<div id="departmentTip"></div>
				</div>
				<div class="item">
					<div class="subTitle">专业：</div>
					<div class="inputBox"><?php echo $form['major'] ?></div>
				</div>
				<div class="item">
					<div class="subTitle">宿舍地址：</div>
					<div class="inputBox"><?php echo $form['room'] ?></div>
				</div>
				<div class="item">
					<div class="subTitle">广州工商银行卡号：</div>
					<div class="inputBox"><?php echo $form['bankCardNum'] ?></div>
				</div>
				<div class="item">
					<div class="subTitle">联系电话：</div>
					<div class="inputBox"><?php echo $form['tel'] ?></div>
					<div id="telTip"></div>
				</div>
				<div class="item">
					<div class="subTitle">电子邮箱：</div>
					<div class="inputBox"><?php echo $form['email'] ?></div>
					<div id="emailTip"></div>
				</div>
				<div class="item">
					<div class="subTitle">上传相片：</div>
					<div class="inputBox"><?php echo $form['pic'] ?></div>
					<div id="picTip"></div>
				</div>
				<div class="item">
					<div class="subTitle">相片预览：</div>
					<div class="inputBox">
						<img name="viewphoto" id="viewPhoto" onload="Reset_ImgSize(this, 150, 200);" src="<?php echo Up_DIR . 'pic/' . $user['pic'] ?>" alt="相片预览"/></img>
					</div>
				</div>

			</div>
			<div style="margin:10px auto">
				<input type="submit" id="s" class="botton" value="修 改" />
				<input type="reset" class="botton" value="重 置" />
			</div>
		</form>
	</div>
</div>
<?php require($footer) ?>

<script type="text/javascript">
var maj=new Array();
<?php
//构造js形式的数组
$i=0;
foreach ($majors as $k => $v){
	foreach ($v as $kk => $vv){
		foreach ($vv as $kkk => $vvv){
			echo "maj[$i]=new Array();";
			echo "maj[$i][0]='$k';";
			echo "maj[$i][1]='$kk';";
			echo "maj[$i][2]='$vvv';";
			$i++;
		}
	}
}
?>
//初始化“学院”选项
	var college = document.getElementById('college');
	var count=maj.length;
	var k=1;
	for(var j=0;j<count;j++){
		if(k==1 || maj[j-1][0]!= maj[j][0]){
			college.options[k]=new Option(maj[j][0],maj[j][0]);
			k++;
		}	
	}
//根据“学院”的值构造“系”的范围
function selectDepartment(){
	var college = document.getElementById('college');
	var department = document.getElementById('department');
	var major = document.getElementById('major');
	var count=maj.length;
	department.length=1;
	major.length=1;
	var k=1;
	for(var j=0;j<count;j++){
		if(maj[j][0] == college.value && (k==1 || maj[j-1][1]!= maj[j][1] )){
			department.options[k]=new Option(maj[j][1],maj[j][1]);
			k++;
		}	
	}
}
//根据“学院”和“系”的值构造“专业”的范围
function selectMajor(){
	var college = document.getElementById('college');
	var department = document.getElementById('department');
	var major = document.getElementById('major');
	var count=maj.length;
	major.length=1;
	var k=1;
	for(var j=0;j<count;j++){
		if(maj[j][0]==college.value && maj[j][1]==department.value ){
			major.options[k]=new Option(maj[j][2],maj[j][2]);
			k++;
		}	
	}
}
selectDepartment();
</script>
</body>
</html>